package com.jozen.smart_toilet_system.adapter;

import android.widget.ImageView;

import com.jozen.modelbase.netwoek.util.GlideUtil;
import com.jozen.smart_toilet_system.R;
import com.jozen.smart_toilet_system.bean.BannerData;
import com.zhpan.bannerview.BaseBannerAdapter;
import com.zhpan.bannerview.BaseViewHolder;

/**
 * 图片广告适配器
 */
public class BannerAdapter extends BaseBannerAdapter<BannerData> {


    @Override
    protected void bindData(BaseViewHolder<BannerData> holder, BannerData data, int position, int pageSize) {
        try {
            ImageView imageView = holder.findViewById(R.id.banner_image);
//            imageView.setImageResource(0);
            GlideUtil.loadImageWithoutCache(data.getImgUrl(), R.drawable.ic_advertisement_def, imageView);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public int getLayoutId(int viewType) {
        return R.layout.item_banner;
    }

}